<?php
/**
 * TomatoCMS
 *
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 *
 * @copyright    Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license        http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version     $Id: assignment.php 2793 2010-05-03 18:48:14Z huuphuoc $
 * @since        2.0.5
 */

interface Assignment_Models_Interface_Assignment
{
    /**
    * Search for assignment by collection of conditions
    *
    * @param int $offset
    * @param int $count
    * @param array $exp Searching conditions. An array contain various conditions, keys including:
    * - id
    * @return Tomato_Model_RecordSet
    */
    public function find($offset, $count, $exp = null);

    /**
    * Count the number of aissgnment by collection of conditions
    *
    * @param array $exp Searching conditions (@see find)
    * @return int
    */
    public function count($exp = null);

    /**
     * Get product info by order detail
     * @param: $id Id of order detail
     * @return: Tomato_Model_Recordset
    **/
    public function getODById($id);

    /**
     * Get assignment info by id
     * @param: $id Id of assignment
     * @return: Assignment_Models_Assignment
     **/
    public function getById($id);

    /**
     * Get actual process status info by id
     * @param: $process_id Id of process
     * @return: Tomato_Model_Recordset
     **/
    public function getPSById($process_id);

    /**
     * Get step or status code by id
     * Return object of step/status codes
     * @param: $id Id of step_status
     * @return: Tomato_Model_Recordset
     **/
    public function getSSById($id);

    /**
    * Update assignment
    * @param: $assignment Assignment_Models_Assignment
    * @return: void
    **/
    public function update($assignment);

    /**
     * Get order info for assignment
     * @param: $id Id of Order
     * @return: Tomato_Model_Recordset
    **/
    public function getOrderById($id);

    /**
     * Get step and status by type
     * @param: $type Type of status
     * @param: $enterprise_id Id of current enterprise
     * $type = 0 is status
     * $type = 1 is step
     * $type = null get all without type
     * @return Tomato_Model_Recordset
    **/
    /**public function getSSByType($enterprise_id = null, $type = null);*/

    /**
     * Get role by nam
     * @param: $name Name of role
     * @return: Core_Models_Role
    **/
    public function getRoleByName($name);

    /**
     * Get all process id by status id
     * @param: $id Id of Stutus
     * @return: Tomato_Model_Recordset
     **/
    public function getPBySId($id);

    /**
     * Get all process by type
     * @param: $type Type of Process
     * $type = 1 is assignment, $type = 2 is tracking, $typ = null get all
     * @return: Tomato_Model_Recordset
     **/
    public function getPByType($type=null);

    /**
     * Add new assignment
     * $assignment Assignment_Models_Assignment
     * @return int
     **/
    public function add($assignment);
}

